package com.youbo.ysqd.tools;

import com.alibaba.fastjson.JSON;
import com.youbo.ysqd.event.SearchReceive;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Test {




    static String xxx="";

    public static void main(String[] ar){

        Map<String,Object> map=new ConcurrentHashMap<>();
        Map<String,Object> deviceInfo=new ConcurrentHashMap<>();


        deviceInfo.put("platform",2);
        deviceInfo.put("sdkVersion","14.4.2");
        deviceInfo.put("brand","iPhone");
        deviceInfo.put("cameraAuthorized",0);
        deviceInfo.put("version","3.1.10");
        deviceInfo.put("locationAuthorized",0);
        deviceInfo.put("latitude","35.646518");
        deviceInfo.put("longitude","111.500463");


        map.put("username","test");
        map.put("password","test");

        deviceInfo.put("imeiCode","C4354775-B08C-4FD8-B995-CE597FE36668");
        deviceInfo.put("model","iPhone 12");

        map.put("deviceInfo",deviceInfo);
        map.put("authType",0);

        String json=JSON.toJSONString(map);


        System.out.println(json);

        String response= HttpUtils.post("https://napp-api.wbtech.com/v1/login", json,null);

        System.out.println(response);
    }




    public static  String readFileContent(String fileName) {
        File file = new File(fileName);
        BufferedReader reader = null;
        StringBuffer sbf = new StringBuffer();
        try {
            reader = new BufferedReader(new FileReader(file));
            String tempStr;
            while ((tempStr = reader.readLine()) != null) {
                sbf.insert(0,tempStr);
            }
            reader.close();
            return sbf.toString();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
        }
        return sbf.toString();
    }

}
